<%-- Created by IntelliJ IDEA. --%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
  <head>
    <title>add Cookie</title>
  </head>
  <body>
    Name:<%=request.getParameter("name")%><br>
    Age:<%=request.getParameter("age")%><br>
    School:<%=request.getParameter("age")%><br>

    <%
      String name = request.getParameter("name");
      String age = request.getParameter("age");
      String school = request.getParameter("school"); //Chinese Chater


      //NEW Cookie_1  Cookie_2 3
      Cookie ck1 = new Cookie("name",name);
      Cookie ck2 = new Cookie("age",age);
      Cookie ck3 = new Cookie("school",java.net.URLEncoder.encode(school ,"gbk"));


      //set timer s
      ck1.setMaxAge(300);
      ck2.setMaxAge(300);
      ck3.setMaxAge(300);

      //ADD COOKIE
      response.addCookie(ck1);
      response.addCookie(ck2);
      response.addCookie(ck3);

    %>

  </body>
</html>